package com.lehecai.core.game;

import com.lehecai.core.IntegerBeanLabelItem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.List;

/**
 * 游戏组别
 * @author He Wang
 */
public class GameGroup extends IntegerBeanLabelItem {

	private static final long serialVersionUID = 7009455804239792650L;
	private static final Logger logger = LoggerFactory.getLogger(GameGroup.class.getName());
	
	private static List<GameGroup> items = new ArrayList<GameGroup>();
	private static List<GameGroup> queryItems = new ArrayList<GameGroup>();
	
	protected GameGroup(String name, int value) {
		this(name, value, false);
	}
	
	protected GameGroup(String name, int value, boolean queryOnly) {
		super(GameGroup.class.getName(), name, value);
		queryItems.add(this);
		if (!queryOnly) {
			items.add(this);
		}
	}
	
	public static GameGroup getItem(int value){
		try {
			return (GameGroup)GameGroup.getResult(GameGroup.class.getName(), value);
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			return null;
		}
	}
	
	public static List<GameGroup> getItems() {
		return items;
	}
	
	public static List<GameGroup> getQueryItems() {
		return queryItems;
	}

	public static final GameGroup ALL = new GameGroup("全部", -1, true);
	public static final GameGroup GAME_GROUP_RPG = new GameGroup("角色扮演 ", 1);
	public static final GameGroup GAME_GROUP_SLG = new GameGroup("战争策略", 2);
	public static final GameGroup GAME_GROUP_SPG = new GameGroup("休闲竞技", 3);
	public static final GameGroup GAME_GROUP_SIM = new GameGroup("模拟经营", 4);
	public static final GameGroup GAME_GROUP_EDU = new GameGroup("社区养成", 5);
	public static final GameGroup GAME_GROUP_RTS = new GameGroup("即时策略", 6);
	public static final GameGroup GAME_GROUP_PUZ = new GameGroup("益智游戏", 7);
	public static final GameGroup GAME_GROUP_TAB = new GameGroup("棋牌 ", 8);
	public static final GameGroup GAME_GROUP_OTHER = new GameGroup("其他", 9);
}
